package com.simple.base.resolver;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

import com.simple.util.ExceptionUtil;
import com.simple.util.common.LocaleUtil;

public class ServiceHandlerExceptionResolver implements HandlerExceptionResolver {
	
    @Override
    public ModelAndView resolveException(final HttpServletRequest request,
                    final HttpServletResponse response, final Object handler, final Exception ex) {
    	final String siteLanguage = LocaleUtil.getLocaleFromRquest(request);
        return ExceptionUtil.handleServiceException(siteLanguage,ex); 
    }
}